<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>管理平台首页 - 欢迎使用！</title>

    <link href="<?php echo DWZ_URL; ?>themes/default/style.css" rel="stylesheet" type="text/css" media="screen"/>
    <link href="<?php echo DWZ_URL; ?>themes/css/core.css" rel="stylesheet" type="text/css" media="screen"/>
    <link href="<?php echo DWZ_URL; ?>themes/css/print.css" rel="stylesheet" type="text/css" media="print"/>
    <link href="<?php echo DWZ_URL; ?>uploadify/css/uploadify.css" rel="stylesheet" type="text/css" media="screen"/>
    <!--[if IE]>
    <link href="<?php echo DWZ_URL; ?>themes/css/ieHack.css" rel="stylesheet" type="text/css" media="screen"/>
    <![endif]-->

    <!--[if lte IE 9]>
    <script src="<?php echo DWZ_URL; ?>js/speedup.js" type="text/javascript"></script>
    <![endif]-->

    <script src="<?php echo DWZ_URL; ?>js/jquery-1.7.2.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/jquery.cookie.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/jquery.validate.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/jquery.bgiframe.js" type="text/javascript"></script>
    <!-- <script src="<?php echo DWZ_URL; ?>xheditor/xheditor-1.2.1.min.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>xheditor/xheditor_lang/zh-cn.js" type="text/javascript"></script>-->
    <script src="<?php echo DWZ_URL; ?>uploadify/scripts/jquery.uploadify.js" type="text/javascript"></script>

    <!-- svg图表  supports Firefox 3.0+, Safari 3.0+, Chrome 5.0+, Opera 9.5+ and Internet Explorer 6.0+-->
    <script type="text/javascript" src="<?php echo DWZ_URL; ?>chart/raphael.js"></script>
    <script type="text/javascript" src="<?php echo DWZ_URL; ?>chart/g.raphael.js"></script>
    <script type="text/javascript" src="<?php echo DWZ_URL; ?>chart/g.bar.js"></script>
    <script type="text/javascript" src="<?php echo DWZ_URL; ?>chart/g.line.js"></script>
    <script type="text/javascript" src="<?php echo DWZ_URL; ?>chart/g.pie.js"></script>
    <script type="text/javascript" src="<?php echo DWZ_URL; ?>chart/g.dot.js"></script>

    <script src="<?php echo DWZ_URL; ?>js/dwz.core.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.util.date.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.validate.method.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.regional.zh.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.barDrag.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.drag.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.tree.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.accordion.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.ui.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.theme.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.switchEnv.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.alertMsg.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.contextmenu.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.navTab.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.tab.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.resize.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.dialog.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.dialogDrag.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.sortDrag.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.cssTable.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.stable.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.taskBar.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.ajax.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.pagination.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.database.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.datepicker.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.effects.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.panel.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.checkbox.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.history.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.combox.js" type="text/javascript"></script>
    <script src="<?php echo DWZ_URL; ?>js/dwz.print.js" type="text/javascript"></script>
    <!--
    <script src="<?php echo DWZ_URL; ?>bin/dwz.min.js" type="text/javascript"></script>
    -->
    <script src="<?php echo DWZ_URL; ?>js/dwz.regional.zh.js" type="text/javascript"></script>

    <script type="text/javascript">
        function closePM(){
            $.cookie("program_maxim",1,{path: "/",expires:1,domain: "<?php echo getHttpHost(false); ?>"});
            return true;
        }
        $(function(){
            DWZ.init("<?php echo DWZ_URL; ?>dwz.frag.xml", {
                loginUrl:"login_dialog.html", loginTitle:"登录",	// 弹出登录对话框
                //loginUrl:"<?php echo DWZ_URL; ?>login.html",	// 跳到登录页面
                statusCode:{ok:200, error:300, timeout:301}, //【可选】
                pageInfo:{pageNum:"pageNum", numPerPage:"numPerPage", orderField:"orderField", orderDirection:"orderDirection"}, //【可选】
                debug:false,	// 调试模式 【true|false】
                callback:function(){
                    initEnv();
                    $("#themeList").theme({themeBase:"<?php echo DWZ_URL; ?>themes"}); // themeBase 相对于index页面的主题base路径
                    //navTab.openTab("main", "<?php echo SITE_URL.'index.php?c=index&a=myHome'; ?>",{title:"我的主页"});
                    if($.cookie('program_maxim') != 1){
                        $.pdialog.open('<?php echo SITE_URL . 'index.php?c=index&a=programMaxim'; ?>', 'program_maxim', '今天你做到了吗？', {close:closePM,height: 360});
                    }
                }
            });
        });

        //动态加载 css js 文件
        $.extend({
            includePath: '',
            include: function(file) {
                var files = typeof file == "string" ? [file]:file;
                for (var i = 0; i < files.length; i++) {
                    var name = files[i].replace(/^\s|\s$/g, "");
                    var att = name.split('.');
                    var ext = att[att.length - 1].toLowerCase();
                    var isCSS = ext == "css";
                    var tag = isCSS ? "link" : "script";
                    var attr = isCSS ? " type='text/css' rel='stylesheet' " : " language='javascript' type='text/javascript' ";
                    var link = (isCSS ? "href" : "src") + "='" + $.includePath + name + "'";
                    if ($(tag + "[" + link + "]").length == 0) $("head").append("<" + tag + attr + link + "></" + tag + ">");
                }
            }
        });

		/*
		*数据管理页面 全选 反选 操作
		*/
        function clickCheckbox() {
            $(".chooseAll").click(function () {
                var status = $(this).prop('checked');
                $("tbody input[type='checkbox']").prop("checked", status);
                $(".chooseAll").prop("checked", status);
                $(".unsetAll").prop("checked", false);
            });
            $(".unsetAll").click(function () {
                var status = $(this).prop('checked');
                $("tbody input[type='checkbox']").each(function () {
                    $(this).prop("checked", !$(this).prop("checked"));
                });
                $(".unsetAll").prop("checked", status);
                $(".chooseAll").prop("checked", false);
            });
        };

    </script>
</head>

<body scroll="no">
<div id="layout">
<div id="header">
    <div class="headerNav">
        <a class="logo" href="/admin/">logo</a>
        <ul class="nav">
            <li id="switchEnvBox"><a href="javascript:">消息提醒（<span style="color: red">10</span>）</a>
                <ul>
                    <li><a href="#">任务（<span style="color: red">10</span>）</a></li>
                    <li><a href="#">消息（<span style="color: red">6</span>）</a></li>
                    <li><a href="#">@我（<span style="color: red">9</span>）</a></li>
                    <li><a href="#">关注（<span style="color: red">10</span>）</a></li>
                    <li><a href="#">评论（<span style="color: red">10</span>）</a></li>
                </ul>
            </li>
            <li><a href="/www/" target="_blank">主站</a></li>
            <li><a href="/wap/" target="_blank">手机站</a></li>
            <li><a href="/studio/" target="_blank">工作室站</a></li>
            <li><a href="http://weibo.com/iwhoopsfeed" target="_blank">微博</a></li>
            <li><a href="javascript:void(0);" id="logout">退出</a></li>
        </ul>
        <ul class="themeList" id="themeList">
            <li theme="default"><div class="selected">蓝色</div></li>
            <li theme="green"><div>绿色</div></li>
            <!--<li theme="red"><div>红色</div></li>-->
            <li theme="purple"><div>紫色</div></li>
            <li theme="silver"><div>银色</div></li>
            <li theme="azure"><div>天蓝</div></li>
        </ul>
    </div>

    <!-- navMenu -->

</div>

<div id="leftside">
    <div id="sidebar_s">
        <div class="collapse">
            <div class="toggleCollapse"><div></div></div>
        </div>
    </div>
    <div id="sidebar">
        <div class="toggleCollapse"><h2>主菜单</h2><div>收缩</div></div>

        <?php
        function getTree($data,$user_cate_ids)
        {
            $html = '';
            foreach($data as $k => $v)
            {
                if(in_array($v['cate_id'],$user_cate_ids) && $v['is_show']){
                    if(isset($v['cate_child']))
                    {   //父亲找到儿子
                        $html .= '<li><a>'.$v['cate_name'].'</a>';
                        $html .= getTree($v['cate_child'],$user_cate_ids);
                        $html .= '</li>';
                    }else{
                        $html .= '<li><a href="'.getHttpHost(true).'/admin/index.php?c='.$v['action_url'].'" target="navTab" rel="'.$v['action_url'].'">'.$v['cate_name'].'</a></li>';
                    }
                }
            }
            return '<ul>'.$html.'</ul>';
        }

        $parent_array = array();//记录每一个父节点的地址引用
        $tree_array = array();//整颗树的数组

        foreach($menu_arr as $v){

            $node_num = ($v['right_value']-$v['left_value'] - 1)/2;

            if($v['parent_cate_id']){//如果没有parent_cate_id则是顶层

                $parent_array[$v['parent_cate_id']]['cate_child'][$v['cate_id']] = $v;

                if($node_num > 0){

                    $parent_array[$v['cate_id']] = &$parent_array[$v['parent_cate_id']]['cate_child'][$v['cate_id']];
                }

            }else{
                $tree_array[$v['cate_id']] = $v;

                if($node_num > 0){

                    $parent_array[$v['cate_id']] = &$tree_array[$v['cate_id']];
                }
            }
        }
        ?>
        <div class="accordion" fillSpace="sidebar">
            <?php foreach($tree_array as $value){
                if(in_array($value['cate_id'],$user_cate_ids) && $value['is_show']){
                    ?>
                    <div class="accordionHeader">
                        <h2><span>Folder</span><?php echo $value['cate_name'];?></h2>
                    </div>
                    <div class="accordionContent">
                        <ul class="tree treeFolder">
                            <?php if($value['cate_child']) echo substr(substr(getTree($value['cate_child'],$user_cate_ids),4),0,-5);?>
                        </ul>
                    </div>
                <?php }}?>
        </div>
    </div>
</div>
<div id="container">
    <div id="navTab" class="tabsPage">
        <div class="tabsPageHeader">
            <div class="tabsPageHeaderContent"><!-- 显示左右控制时添加 class="tabsPageHeaderMargin" -->
                <ul class="navTab-tab">
                    <li tabid="main" class="main"><a href="javascript:;"><span><span class="home_icon">我的主页</span></span></a></li>
                </ul>
            </div>
            <div class="tabsLeft">left</div><!-- 禁用只需要添加一个样式 class="tabsLeft tabsLeftDisabled" -->
            <div class="tabsRight">right</div><!-- 禁用只需要添加一个样式 class="tabsRight tabsRightDisabled" -->
            <div class="tabsMore">more</div>
        </div>
        <ul class="tabsMoreList">
            <li><a href="javascript:;">我的主页</a></li>
        </ul>
        <div class="navTab-panel tabsPageContent layoutBox">
            <div class="page unitBox">
                <div class="accountInfo">
                    <div class="alertInfo">
                        <p><a href="#" target="_blank" style="line-height:19px;font-weight: bold">系统扩展开发帮助</a></p>
                        <p><a href="#" target="_blank" style="line-height:19px;font-weight: bold;color: red">开发流程简介</a></p>
                    </div>
                    <div class="right">
                        <p><a href="#" target="_blank" style="line-height:19px">后台使用指导</a></p>
                        <p><a href="#" target="_blank" style="line-height:19px">新功能上线提醒</a></p>
                    </div>
                    <p><span>通用综合信息管理平台</span></p>
                    <p>DWZ官方微博:<a href="http://weibo.com/iwhoopsfeed" target="_blank">http://weibo.com/iwhoopsfeed</a></p>
                </div>
                <div class="pageFormContent" layoutH="80">
                    <p style="color:red">WhoopsFeed官方微博 <a href="http://weibo.com/iwhoopsfeed" target="_blank">http://weibo.com/iwhoopsfeed</a></p>
                    <p style="color:red">WhoopsFeed官方微群 <a href="http://weibo.com/iwhoopsfeed" target="_blank">http://weibo.com/iwhoopsfeed</a></p>

                    <div class="divider"></div>
                    <h2>WhoopsFeed站内统计:</h2>
                    <p style="padding-left: 20px;padding-top: 20px">
                        统计内容
                    </p>
                </div>
            </div>
        </div>
    </div>
</div>

</div>

<div id="footer">Copyright &copy; <?php echo date('Y') == 2013 ? 2013 : 2013 . '-' .date('Y'); ?> www.whoopsfeed.com Inc. All Rights Reserved.</div>
<script type="text/javascript">
    $(document).ready(function(){
        var width_px = (parseInt($('.nav').css('width'))+10)+'px';
        $('.headerNav').append('<a style="color:#B9CCDA;position:absolute;right:'+width_px+';top:8px" href="#">欢迎：zhouyang 登录使用！</a>');

        $('#logout').live('click',function(){
            alertMsg.confirm("您确定要退出管理平台吗?", {
                okCall: function(){
                    window.location.href = '<?php echo getHttpHost(); ?>/admin/index.php?c=user&a=logout';
                }
            });
        });
    });
</script>
</body>
</html>